<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Star extends Model
{
    protected $fillable = ['name', 'movie_count', 't_id'];

    public function moviesAsActor() 
    {   // 参演的电影
        return $this->belongsToMany(Movie::class, 'actor_movie');
    }
    public function moviesAsDirector()
    {
        // 导演的电影
        return $this->belongsToMany(Movie::class, 'director_movie');
    }
    public function moviesAsAuthor()
    {
        // 编剧的电影
        return $this->belongsToMany(Movie::class, 'author_movie');
    }
}
